home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / DataScope 2.0.3 / DataScope2l / DSIncludes / fview.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-04  |  4.7 KB  |  147 lines  |  [TEXT/MPS ]

  1. /*
  2. *   compiles and links under MPW C 2.0.2
  3. *   The following two lines are in my stdio.h:
  4. *  #define malloc(A) NewPtr(A)
  5. *  #define free(A) DisposPtr(A)
  6. */
  7.  
  8. #include <stdio.h>
  9. #include <memory.h>
  10. #include "vdevice.h"
  11.  
  12. /*
  13. *  Window types are:
  14. *    Notebook with a text representation of the user's notes and eqn's
  15. *    Text window displaying the numbers as a spreadsheet-type array.
  16. *    Simple image window with integral pixel expansion.
  17. *    Bi-linear interpolation window - an image of the data.
  18. *    Polar data generated into a Cartesian window.
  19. *
  20. *    fdatawin holds the binary dataset.
  21. */
  22.  
  23. struct fnotewin {
  24.     TEHandle
  25.         trec;                /* TextEdit record which holds notes */
  26.     Rect
  27.         vis;                /* Visible portion of the notebook */
  28. };
  29.  
  30. struct ftextwin {
  31.     int
  32.         synchon,            /* synchronized window operation */
  33.         offt,offl,            /* offset from 0,0 into dataset for scroll bars */
  34.         forcedraw;            /* forces complete redraw of window */
  35.     Point 
  36.         selanchor,            /* selection anchor point in cell coords */
  37.         ccount,                /* how many cells are there visible in each direction? */
  38.         csize;                /* how big is each cell in window */
  39.     Rect
  40.         disp,                /* pixel rect which the array's text will go in */
  41.         sel;                /* selection region, UL, LR in cell coords */
  42.     ControlHandle    
  43.         vbar,hbar;            /* scroll bars */
  44.     char 
  45.         *font;                /* what font to use */
  46.     int fsize;                /* size of that font */
  47. };
  48.  
  49. struct fimgwin {            /* Image window */
  50.     Rect
  51.         viewport,            /* visible port in imaging window */
  52.         xr;                    /* xor rectangle marks current selection */
  53.     int
  54.         xsize,ysize,        /* Size of the window as displayed */
  55.         exx,exy;            /* expansion factors, when displayed as an image */
  56. };
  57.  
  58. struct fbiwin {                /* Bilinear interp Image window */
  59.     Rect
  60.         viewport,            /* visible port in imaging window */
  61.         xr;                    /* xor rectangle marks current selection */
  62.     int
  63.         xsize,ysize,        /* Size of the window as displayed */
  64.         exx,exy;            /* expansion factor, when displayed as an image */
  65. };
  66.  
  67. struct fpolwin {            /* Polar data structure */
  68.     Rect
  69.         viewport,            /* visible port in imaging window */
  70.         xr;                    /* xor rectangle marks current selection */
  71.     int
  72.         angleshift,            /* angle shift for this image */
  73.         xsize,ysize,        /* Size of the window as displayed */
  74.         exx,exy;            /* expansion factor, when displayed as an image */
  75. };
  76.  
  77. struct fdatawin {
  78.     float 
  79.         valmax,                /* maximum value in the set */
  80.         valmin,                /* minimum value in the set */
  81.         *xvals,                /* values of the x independent var along axis */
  82.         *yvals,                /* increments in the independent vars */
  83.         *vals;                /* floating point data set */
  84.     int 
  85.         top, bottom,        /* selection region in dataset */
  86.         left, right,
  87.         angleshift,            /* zero axis shift in pi/2 increments */
  88.         xsize,ysize,        /* how big to make image (independent of integer expansion) */
  89.         cmin,cmax,            /* color range to use when color scaling the data */
  90.         exx,exy,            /* expansion factors for generating the image */
  91.         refcount,            /* keep track of references for freeing later */
  92.         contentlen,            /* length of content field */
  93.         xdim,ydim;            /* x and y dimensions of data set */
  94.     char 
  95.         needsave,            /* have changes been made which require saving? */
  96.         dvar[20],            /* dependent var */
  97.         xvar[20],            /* x axis label */
  98.         yvar[20],            /* y axis label */
  99.         fname[100],            /* filename that data came from */
  100.         labfmt[50],            /* row/col label format for use in sprintf */
  101.         fmt[50];            /* printing format to use in sprintf */
  102.  
  103.     Rect
  104.         viewport;            /* visible port in imaging window */
  105.         
  106.     CharsHandle
  107.         content;            /* handle to contents of notebook */
  108.         
  109.     struct Mwin                /* which image windows were generated from this data? */
  110.         *notes,                /* notebook window which goes with this data */
  111.         *text,                /* text display of the floating point numbers */
  112.         *image,                /* simple image scaling */
  113.         *interp,            /* interpolated image, using bilinear interpolation */
  114.         *polar;                /* polar transformation */
  115. };
  116.     
  117. struct Mwin {
  118.     WindowPtr win;            /* reference to window */
  119.     int wintype;            /* window type for this record */
  120.                             /* the window pointers below could be a union, but why bother? */
  121.     VDevice 
  122.         vdev;                /* Virtual drawing device with its own colors */
  123.     Rect
  124.         pref;                /* preferred display rectangle, used for odd-width datasets */
  125.         
  126.     struct fnotewin *nw;    /* notebook window */
  127.     struct ftextwin *cw;    /* text window */
  128.     struct fimgwin *iw;        /* image window */
  129.     struct fbiwin *bw;        /* bilinear interp window */
  130.     struct fpolwin *pw;        /* polar data window */
  131.     struct fdatawin *dat;    /* actual floating point data structure */
  132.     struct Mwin *next;        /* linked list */
  133. };
  134.  
  135. struct Mwin *findm();        /* finding an mwindow in the list */
  136. struct fdatawin *newdatawin();
  137.  
  138. /******************************************************************************/
  139. /*  The window type defines.
  140. */
  141. #define FTEXT 1
  142. #define FIMG 2
  143. #define FBI 3
  144. #define FPOL 4
  145. #define FNOTES 5
  146.  
  147.